<?php
/**
 * Created by PhpStorm.
 * User: admin
 * Date: 2019/6/6
 * Time: 10:48
 */

namespace app\mobile\controller;


use app\admin\model\CategoryList;
use app\admin\model\ListsList;
use app\admin\model\LunboList;

class Lists extends Base
{


    public function lists(){
        $lunbo = LunboList::where('category_id',10)->order('sort desc')->select();
        $data = ListsList::order('sort desc')->paginate(10);
        $category = CategoryList::where('id',10)->find();
        $this->assign('lunbo',$lunbo);
        $this->assign('cate_id',$category);
        $this->assign('data',$data);
        $this->assign('category',$category);
        return $this->fetch();
    }

    public function info($id){
        $data = ListsList::where('id',$id)->find();
        $category = CategoryList::where('id',10)->find();
        $left = ListsList::where('id','<',$data['id'])->order('sort desc')->limit(1)->value('id');
        $right = ListsList::where('id','>',$data['id'])->order('sort desc')->limit(1)->value('id');
        $this->assign('cate_id',$category);
        $this->assign('data',$data);
        $this->assign('left',(int)$left);
        $this->assign('right',(int)$right);
        return $this->fetch();
    }

}